package com.example.a26436.newpractise.project;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.example.a26436.newpractise.R;


public class ProjectActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView tvfirstpage;
    private TextView tvKnowledge;
    private TextView tvPublic;
    private TextView tvProject;
    private TextView tvMine;
    private static final String TAG = "ProjectActivity";
    private TextView tvTitle;
    private ProjectFragment mProjectActivity;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_project);
        findviews();
        initdata();
        initevent();

    }

    private void findviews() {
        tvfirstpage = findViewById(R.id.tv_FirstPage_activity_project);
        tvKnowledge = findViewById(R.id.tv_Knowladge_activity_project);
        tvPublic = findViewById(R.id.tv_Public_activity_project);
        tvProject = findViewById(R.id.tv_Project_activity_project);
        tvMine = findViewById(R.id.tv_Mine_activity_project);
        tvTitle = findViewById(R.id.tv_title_activity_project);

    }

    private void initdata() {
        FragmentManager manager = getSupportFragmentManager();
        FragmentTransaction transaction = manager.beginTransaction();
        mProjectActivity = new ProjectFragment();
        transaction.add(R.id.fl_contain_activity_project,mProjectActivity);
        transaction.commit();


    }

    private void initevent() {
        tvfirstpage.setOnClickListener(this);
        tvKnowledge.setOnClickListener(this);
        tvPublic.setOnClickListener(this);

        tvProject.setOnClickListener(this);
        tvMine.setOnClickListener(this);
        tvTitle.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tv_title_activity_project:
                mProjectActivity.scrollToTop();
                break;
            case R.id.tv_FirstPage_activity_project:
                break;
            case R.id.tv_Knowladge_activity_project:
                break;
            case R.id.tv_Public_activity_project:
                break;
            case R.id.tv_Project_activity_project:
                break;
            case R.id.tv_Mine_activity_project:
                break;
            default:
                Log.e(TAG, "onClick: I don't know this onclick,please check!");
                break;
        }

    }



}

